package com.zhsm.fuxi.view.widget

import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.graphics.Path
import android.util.AttributeSet
import android.view.View
import com.zhsm.paipaiout.baselibrary.utils.UIUtils

/**
 * Created by GuZhC on 2018/10/15.
 * describe:
 */
class MapMyLocation(context: Context?, attrs: AttributeSet?) : View(context, attrs) {

    override fun onDraw(canvas: Canvas?) {
        super.onDraw(canvas)
        val paint = Paint()
        paint.color = Color.parseColor("#ffffff")
        paint.isAntiAlias = true
        paint.style = Paint.Style.FILL
        paint.strokeWidth = UIUtils.dip2px(context, 1f).toFloat()
        canvas?.drawCircle(UIUtils.dip2px(context, 11f).toFloat(), UIUtils.dip2px(context, 15f).toFloat(), UIUtils.dip2px(context, 9f).toFloat(), paint)
        paint.color = Color.parseColor("#4D69FD")
        paint.style = Paint.Style.STROKE
        canvas?.drawCircle(UIUtils.dip2px(context, 11f).toFloat(), UIUtils.dip2px(context, 15f).toFloat(), UIUtils.dip2px(context, 6.5f).toFloat(), paint)
        paint.strokeWidth = UIUtils.dip2px(context, 2f).toFloat()
        canvas?.drawCircle(UIUtils.dip2px(context, 11f).toFloat(), UIUtils.dip2px(context, 15f).toFloat(), UIUtils.dip2px(context, 9f).toFloat(), paint)
        paint.style = Paint.Style.FILL
        val path = Path()
        path.moveTo(UIUtils.dip2px(context, 6f).toFloat(),UIUtils.dip2px(context, 7.8f).toFloat())
        path.lineTo(UIUtils.dip2px(context, 11f).toFloat(),UIUtils.dip2px(context, 1f).toFloat())
        path.lineTo(UIUtils.dip2px(context, 16f).toFloat(),UIUtils.dip2px(context, 7.8f).toFloat())
        path.lineTo(UIUtils.dip2px(context, 11f).toFloat(),UIUtils.dip2px(context, 6f).toFloat())
        path.close()
        canvas?.drawPath(path, paint)
    }
}